const {ccclass, property} = cc._decorator;
 
@ccclass
export default class Physize extends cc.Component {
 
    @property({displayName: "是否调试", tooltip: "是否调试"})
    is_debug: boolean = false;// 是否调试
 
    onLoad(){
        // 获取物理引擎
        let manager = cc.director.getPhysicsManager();
        manager.enabled = true;// 开启物理引擎
 
        if (this.is_debug == true) {// 如果可以调试，绘制
            cc.director.getPhysicsManager().debugDrawFlags = 
            cc.PhysicsManager.DrawBits.e_aabbBit |
            cc.PhysicsManager.DrawBits.e_jointBit |
            cc.PhysicsManager.DrawBits.e_shapeBit;
        } else {// 如果不，不绘制
            cc.director.getPhysicsManager().debugDrawFlags = 0;
        }
    }
 
}